<?php
require 'dbcon.php';
$username=$_REQUEST['username'];
$content=$_REQUEST['content'];
date_default_timezone_set('Asia/Shanghai');
$wdate=date("Y-m-d h:i:s");
$sql="INSERT INTO tb_wish(username,content,wdate) VALUES( '{$username}', '{$content}','{$wdate}')";
$rs=$db->query($sql);//执行查询语句$sql，生成结果集$result
$id=mysqli_insert_id($db);//获取刚刚添加的那条记录的id
$db->close();//关闭数据库连接
if ($rs==true)
{
    $rdata=array("msg"=>1,"username"=>$username,"content"=>$content,"wdate"=>$wdate,"id"=>$id);
    echo json_encode($rdata);
    
}
else   
{
   $rdata=array("msg"=>0);
   echo json_encode($rdata);
}

